package com.shuzixiangcun.service.front;

import com.shuzixiangcun.dao.OrderItemsDao;
import com.shuzixiangcun.entity.OrderItems;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 订单详情表(OrderItems)表服务实现类
 *
 * @author makejava
 * @since 2024-06-24 08:26:21
 */
@Service
public class OrderItemsFServiceImpl {
    @Resource
    private OrderItemsDao orderItemsDao;

    /**
     * 通过ID查询单条数据
     *
     * @param orderItemId 主键
     * @return 实例对象
     */

    public OrderItems queryById(Integer orderItemId) {
        return this.orderItemsDao.queryById(orderItemId);
    }

    /**
     * 分页查询
     *
     * @param orderItems  筛选条件
     * @param pageRequest 分页对象
     * @return 查询结果
     */


    /**
     * 新增数据
     *
     * @param orderItems 实例对象
     * @return 实例对象
     */

    public OrderItems insert(OrderItems orderItems) {
        this.orderItemsDao.insert(orderItems);
        return orderItems;
    }

    /**
     * 修改数据
     *
     * @param orderItems 实例对象
     * @return 实例对象
     */

    public OrderItems update(OrderItems orderItems) {
        this.orderItemsDao.update(orderItems);
        return this.queryById(orderItems.getOrderItemId());
    }

    /**
     * 通过主键删除数据
     *
     * @param orderItemId 主键
     * @return 是否成功
     */

    public boolean deleteById(Integer orderItemId) {
        return this.orderItemsDao.deleteById(orderItemId) > 0;
    }
}
